// Copyright  2004-2008 Backplane Ltd.
//
// This file is part of Ubiquity formsPlayer
//
// Ubiquity formsPlayer is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3 of the License, or (at your
// option) any later version.
//
// Ubiquity formsPlayer is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License
// along with Ubiquity formsPlayer If not, see <http://www.gnu.org/licenses/>.
//	
//
//   Purpose: declaration of MSHTMLCSS3Handler.
//   $Id$


#pragma once
#include <map>

typedef std::map<CComBSTR,bool> CMapCComBSTRTobool;

class CMSHTMLCSS3Handler
{
public:
	//<summary>
	//	Creates an instance of the CMSHTMLCSS3Handler, loading sPathToCSS, and storing
	//	pTargetDocument so that as namespace prefixes are added, the object can add
	//	stylesheets to cope with this.
	//</summary>
	CMSHTMLCSS3Handler(IHTMLDocument2 * pTargetDocument,const char * const sPathToCSS,const char * const sChromePath);
	virtual ~CMSHTMLCSS3Handler(void);
	//<summary>adds a copy of the default stylesheet altered for bsPrefix to the document's stylesheet collection</summary>
	//<returns>
	//	S_OK, if the stylesheet was added for this prefix.<br />
	//	S_FALSE, if the stylesheet has already been added for this prefix<br/>
	//	E_PENDING, if the default css template hasn't loaded.  This will normally mean that there is no default stylesheet (default.css) in the chrome directory<br/>
	//</returns>
	HRESULT AddNamespacePrefix(BSTR bsPrefix);
private:
	//<summary>HTML Document to which style must be applied</summary>
	CComQIPtr<IHTMLDocument2> m_pTargetDocument;
	//<summary>contains the text loaded from default.css</summary>
	CString m_sCssFileContent;
	//<summary>maintains a list of already added prefixes, so that we don't do it twice</summary>
	CMapCComBSTRTobool m_lstNamespacePrefixesAlreadyImported;

};
